<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            background-color: rgb(131, 78, 255);
        }
        
        div {
            width: 300px;
            margin: 0 auto;
        }
        
        input {
            width: 100px;
        }
        
        button {
            margin: 0 auto;
        }
    </style>
</head>

<body>
    <div>
        月<input id="wenben" type="text"><br> 日
        <input id="day" type="text"><br>
        <button id="button1">点我计算</button>
        <p id="p"></p>
    </div>

</body>

</html>
<script>
    // 定义输入框,用于获取自己的生日,判断自己的星座!!!
    var button1 = document.getElementById('button1');
    button1.onclick = function() {
        var wenben = document.getElementById('wenben');
        var day = document.getElementById('day');
        var p = document.getElementById('p');
        var wenben1 = wenben.value;
        var day1 = day.value
        console.log(wenben1);
        if (wenben1 == 1 && day1 >= 20 && day1 <= 31) {

            p.innerHTML = "水瓶座";

        } else if (wenben1 == 2 && day1 <= 18 && day1 >= 1) {
            p.innerHTML = "水瓶座";
        } else if (wenben1 == 2 && day1 >= 19 && day1 <= 29) {

            p.innerHTML = "双鱼座";

        } else if (wenben1 == 3 && day1 <= 20 && day1 >= 1) {
            p.innerHTML = "双鱼座";
        } else if (wenben1 == 3 && day1 >= 21 && day1 <= 31) {

            p.innerHTML = "白羊座";

        } else if (wenben1 == 4 && day1 <= 19 && day1 >= 1) {
            p.innerHTML = "白羊座";
        } else if (wenben1 == 4 && day1 >= 20 && day1 <= 30) {

            p.innerHTML = "金牛座";

        } else if (wenben1 == 5 && day1 <= 20 && day1 >= 1) {
            p.innerHTML = "金牛座";
        } else if (wenben1 == 5 && day1 >= 21 && day1 <= 31) {

            p.innerHTML = "双子座";

        } else if (wenben1 == 6 && day1 <= 21 && day1 >= 1) {
            p.innerHTML = "双子座";
        } else if (wenben1 == 6 && day1 >= 22 && day1 <= 30) {

            p.innerHTML = "巨蟹座";

        } else if (wenben1 == 7 && day1 <= 22 && day1 >= 1) {
            p.innerHTML = "巨蟹座";
        } else if (wenben1 == 7 && day1 >= 23 && day1 <= 31) {

            p.innerHTML = "狮子座";

        } else if (wenben1 == 8 && day1 <= 22 && day1 >= 1) {
            p.innerHTML = "狮子座";
        } else if (wenben1 == 8 && day1 >= 23 && day1 <= 31) {

            p.innerHTML = "处女座";

        } else if (wenben1 == 9 && day1 <= 22 && day1 >= 1) {
            p.innerHTML = "处女座";
        } else if (wenben1 == 9 && day1 >= 23 && day1 <= 30) {

            p.innerHTML = "天秤座";

        } else if (wenben1 == 10 && day1 <= 23 && day1 >= 1) {
            p.innerHTML = "天秤座";
        } else if (wenben1 == 10 && day1 >= 24 && day1 <= 30) {

            p.innerHTML = "天蝎座";

        } else if (wenben1 == 11 && day1 <= 24 && day1 >= 1) {
            p.innerHTML = "天蝎座";
        } else if (wenben1 == 11 && day1 >= 13 && day1 <= 30) {

            p.innerHTML = "射手座";

        } else if (wenben1 == 12 && day1 <= 21 && day1 >= 1) {
            p.innerHTML = "射手座";
        } else if (wenben1 == 12 && day1 >= 22 && day1 <= 31) {

            p.innerHTML = "摩羯座";

        } else if (wenben1 == 1 && day1 <= 19 && day1 >= 1) {
            p.innerHTML = "摩羯座";
        } else {
            p.innerHTML = '我好像不行了,不要为难我好吗';
        }
        console.log(wenben1);
        console.log(day1);
    };
</script>